package com.ag.zlw.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.ag.bean.TbShiftType;
import com.ag.common.AgException;
import com.ag.common.IDUtil;
import com.ag.common.IIDService;
import com.ag.zlw.dao.TbShiftTypeDAO;
import com.ag.zlw.service.ShiftTypeService;

/**
 * 班次类型
 * 
 * @author 钟龙伟
 * 
 */

@Service("ShiftTypeService")
public class ShiftTypeServiceImpl implements ShiftTypeService {
	@Resource(name = "ZLWTbShiftTypeDAO")
	private TbShiftTypeDAO tbShiftTypeDAO;

	private String IDs;
	@Resource(name = "iDServiceImpl")
	private IIDService idservice;

	public void save(TbShiftType ShiftType) throws AgException {
		IDs = (String) idservice.findTablePK(IDUtil.TB_SHIFT_TYPE);
		ShiftType.setPsId(IDs);
		tbShiftTypeDAO.save(ShiftType);
	}

	public List<TbShiftType> findAll() {
		return tbShiftTypeDAO.findAll();
	}

	public void delete(TbShiftType ShiftType) {
		TbShiftType tbShiftType = tbShiftTypeDAO.findById(ShiftType.getPsId());
		tbShiftType.setA(IDUtil.DELETE);
		tbShiftTypeDAO.attachDirty(tbShiftType);
	}

	public void modify(TbShiftType ShiftType) {
		tbShiftTypeDAO.attachDirty(ShiftType);
	}
}
